package com.atguigu.realtime.func;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import org.apache.flink.api.common.functions.MapFunction;

/**
 * @author: 洛尘
 * @since: 2023-10-12 20:27
 * @description:
 **/
public class BeanToJsonStrMapFcuntion<T> implements MapFunction<T,String> {
    @Override
    public String map(T bean) throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.propertyNamingStrategy= PropertyNamingStrategy.SnakeCase;
        return JSON.toJSONString(bean,config);
    }
}